/*
*************************************
* PocketGTT
*************************************
This file is part of PocketGTT.

PocketGTT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

PocketGTT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PocketGTT.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0

Rectangle {
    id: btnMapZoom

    height: 48
    width: 48

    //    property alias source: btnImgInfoBack.source
    property color pressedColor: myWin.theme.violet_background
    property color releasedColor: myWin.theme.passaggiview_loading_background

    property bool zoomIn: true

    color: btnMA.pressed ? btnMapZoom.pressedColor : btnMapZoom.releasedColor
    radius: width / 4


    Image {
        id: btnImgInfoBack
        fillMode: Image.PreserveAspectFit
        height: parent.height  * 0.8
        anchors.centerIn: parent
        source: btnMapZoom.zoomIn ? "qrc:ui/zoom_in.svg" : "qrc:ui/zoom_out.svg"
    }



    MouseArea {
        id: btnMA
        anchors.fill: parent
        onClicked: {
            if (btnMapZoom.zoomIn) {
                // increment zoom
                if (mapTile.zoom < 20) {
                    mapTile.zoom = mapTile.zoom + 1;
//                    console.log(mapTile.zoom);
                    mapTile.managZoom();
                }
            }
            else {
                //decrement zoom
                if (mapTile.zoom > 0) {
                    mapTile.zoom = mapTile.zoom - 1;
                    mapTile.managZoom();
//                    console.log(mapTile.zoom);
                }
            }
        }
    }
}
